v<template>
    <div>
        <div>
            <h4 class="font-weight-bold">接口测试</h4>
            <p> This page is an example of basic layout. For more options use
                <strong>Vue starter template generator</strong> in the docs.</p>
        </div>
        <b-card header="欠税重大违法税务负面信息查询：税务负面信息查询" header-tag="span" class="mb-4">
            <Row>
                <i-col span="12">
                    <Form ref="testInterfaceForm" :model="testInterfaceForm" :rules="formRule" :label-width="100">
                        <FormItem label="示例：">
                            <Row>
                                <i-col span="12">
                                纳税人名称： 苏州京奥广告传媒有限公司<br>
                                法人身份证： 352230198808280912
                                </i-col>
                            </Row>
                        </FormItem>
                        <FormItem label="法人身份证号码" prop="idCard">
                            <Row>
                                <i-col span="12">
                                <i-input v-model="testInterfaceForm.idCard" placeholder="法人身份证号码"></i-input>
                                </i-col>
                            </Row>
                        </FormItem>
                        <FormItem label="纳税人名称" prop="taxName">
                            <Row>
                                <i-col span="12">
                                <i-input v-model="testInterfaceForm.taxName" placeholder="纳税人名称"></i-input>
                                </i-col>
                            </Row>
                        </FormItem>
                        <FormItem label="税务登记号" prop="taxNo">
                            <Row>
                                <i-col span="12">
                                <i-input v-model="testInterfaceForm.taxNo" placeholder="税务登记号"></i-input>
                                </i-col>
                            </Row>
                        </FormItem>
                        <FormItem label="">
                            <Row>
                                <i-col span="24" style="color:red">
                                法人身份证号码,与纳税人名称、税务登记号至少一个必填
                                </i-col>
                            </Row>
                        </FormItem>
                        
                        <FormItem>
                            <Button type="primary" @click="loadData()">提交</Button>
                        </FormItem>
                    </Form>
                </i-col>
                <i-col span="12">
                    <div class="result">
                        <tree-view :data="result" :options="{maxDepth: 3}"></tree-view>
                    </div>
                </i-col>
            </Row>

        </b-card>
    </div>
</template>

<style scoped>
.result {
    width: 100%;
    height: 100%;
    border: 2px dashed gray;
    min-height: 480px;
    background-color: cornsilk;
    padding: 10px;
}
</style>


<script>
import Axios from "axios"
export default {
    name: "TestInterfaceECIDetail",
    data() {
        return {
            result: { code: 200 },
            testInterfaceForm: {
                taxName: "",
                idCard: "",
                taxNo: "",
                sign: "d81e05371d9f02bef1a6b6fa7ce69f36"
            },
            formRule: {
            }
        };
    },

    created() {},
    methods: {
        loadData: function() {
            // console.log(this.testInterfaceForm);
            let vm = this;
            if(vm.testInterfaceForm.taxName.trim() == '' 
            && vm.testInterfaceForm.idCard.trim() == ''
            && vm.testInterfaceForm.taxNo.trim() == ''){
                return false;
            }
            Axios.post(
                "/app/v1/apis/13/result",
                this.testInterfaceForm
            )
            .then(
                function(res) {
                    let resp = res.data; // HTTP响应数据
                    let status = res.status; // HTTP响应状态
                    // console.log(res);
                    vm.result = res.data;
                },
                function(err) {}
            )
            .catch(function(err) {});
        }
    }
}
</script>
